<template>
  <div class="main">
    <div class="box-main" v-if="active===0">
      <div class="box-form">
        <div class="logo">
          <img src="@/assets/images/logo.020e864.png" alt="">
        </div>
        <el-row :gutter="20">
          <el-col :span="3"><div class="grid-content bg-purple">手机号码</div></el-col>
          <el-col :span="15"><div class="grid-content bg-purple"><el-input placeholder="请输入手机号码"></el-input></div></el-col>
          <el-col :span="2"><div class="grid-content bg-purple"></div></el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="3"><div class="grid-content bg-purple">验证码</div></el-col>
          <el-col :span="10"><div class="grid-content bg-purple"><el-input placeholder="请输入手机号码"></el-input></div></el-col>
          <el-col :span="4"><div class="grid-content bg-purple"><el-button type="primary">50秒 发送验证码</el-button></div></el-col>
        </el-row>
        <div class="bottoms">
          <el-button type="primary">立即验证</el-button>
          <el-button type="warning">立即重置</el-button>
        </div>
      </div>
    </div>
    <div class="box-main" v-if="active===1">
      <div class="avatar">
        <div class="avatar-box">
          <img src="@/assets/images/User-on@2x.png" alt="">
          <a href="javascript:void (0)" class="bottom"><i class="el-icon-edit"></i> 编辑</a>
        </div>
      </div>
      <div class="form">
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
          <el-form-item label="用户名" prop="name">
            <el-input v-model="ruleForm.name" placeholder="请输入用户名"></el-input>
          </el-form-item>
          <el-form-item label="手机号" prop="name">
            <el-input v-model="ruleForm.name" placeholder="请输入手机号"></el-input>
          </el-form-item>
          <el-form-item label="密码" prop="name">
            <el-input v-model="ruleForm.name" placeholder="请输入密码"></el-input>
          </el-form-item>
          <el-form-item label="确认密码" prop="name">
            <el-input v-model="ruleForm.name" placeholder="请确认密码"></el-input>
          </el-form-item>
          <el-form-item label="提现密码" prop="name">
            <el-input v-model="ruleForm.name" placeholder="请输入提现密码"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm('ruleForm')">立即修改</el-button>
            <el-button @click="resetForm('ruleForm')">返回上一级</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data(){
      return{
        active:1,
        ruleForm: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        rules: {
          name: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          region: [
            { required: true, message: '请选择活动区域', trigger: 'change' }
          ],
          date1: [
            { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
          ],
          date2: [
            { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
          ],
          type: [
            { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
          ],
          resource: [
            { required: true, message: '请选择活动资源', trigger: 'change' }
          ],
          desc: [
            { required: true, message: '请填写活动形式', trigger: 'blur' }
          ]
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>

<style scoped lang="scss">
.main{
  width: 100%;
  min-height: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
  .box-main{
    width: 600px;
    min-height: 400px;
    .avatar{
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      height: 100px;
      margin-top: 150px;
      .avatar-box{
        width: 100px;
        height: 100px;
        border-radius: 50%;
        background: rgba(255,255,255,0.6);
        display: flex;
        box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
        justify-content: center;
        align-items: center;
        position: relative;
        img{
          width: 80px;
          height: 80px;
          border-radius: 50%;
          object-fit: cover;
        }
        .bottom{
          width: 80%;
          height: 20px;
          color: #0F4DEF;
          position: absolute;
          font-size: 12px;
          background: rgba(255,255,255,0.6);
          bottom: 0;
          display: flex;
          justify-content: center;
          align-items: center;
          border-radius: 10px;
        }
      }
    }
    .form{
      width: 100%;
      min-height: 300px;
      margin-top: 50px;

    }
    .box-form{
      width: 100%;
      height: 60px;
      margin-top: 100px;
      .logo{
        width: 100%;
        text-align: center;
        img{
          margin-left: -150px;
          height: 100px;
        }
      }
      .grid-content{
        height: 60px;
        line-height: 60px;
        font-size: 14px;
        color: #666;
        text-align: right;
      }
      .bottoms{
        width: 100%;
        display: flex;
        margin-top: 20px;
        padding: 0 0 0 100px;
        box-sizing: border-box;
      }
    }
  }
}
</style>